#!/usr/bin/env python
# -*- coding: utf-8 -*-
#code:utf-8
#
# Copyright(C) 2011 SupDo.com
# Licensed under the GUN License, Version 3.0 (the "License");
# 
# File:        main.py
# Author:      KuKei
# Create Date: 2011-04-18
# Description: 入口页面视图
# Modify Date: 2011-04-18

from sd.cms.views.admin import AdminBaseView
from sd.cms.lib.decorator import powerLevel
from sd.cms.lib import Params

class MainView(AdminBaseView):
    
    def default(self, **args):
        return self.render('/admin/default.html')
    
    def innerDefault(self, **args):
        return self.render('/admin/innerDefault.html')
    
    def flushmc(self, **args):
        self.mc.flushNS()
        self.result.flag = True
        self.result.msg = '刷新成功！'
        return self.render_json()
    
    def leftmenu(self, **args):
        self.viewData['etype'] = args['leftMenu']
        return self.render('/admin/menu.html')

##@powerLevel(Params.ADMINISTRATOR)
def default(request):
    return action(request, action='default')
    
def innerDefault(request):
    return action(request, action='innerDefault')

def action(request, **args):
    return apply(MainView(request).action, (), args)